package com.mida.dms.knw.controller;



import com.mida.dms.knw.entity.KnwConceptualDetail;
import com.mida.dms.knw.entity.vo.BodyTreeVo;
import com.mida.dms.knw.entity.vo.KnwIndividualSoltVos;
import com.mida.dms.knw.entity.vo.KnwNoumenonVo;
import com.mida.dms.knw.entity.vo.KnwSlotVo;
import com.mida.dms.knw.service.KnwReportService;
import com.mida.dms.knw.vo.*;
import com.mida.tool.common.result.ListResult;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/knwReport")
@CrossOrigin
public class KnwReportController {

    @Autowired
    private KnwReportService knwReportService;

//    @Autowired
//    private ILoginUserService loginUserService;

    /**
     * 1.查询所有本体
     */
    @ApiOperation(value = "查询所有本体", notes = "查询所有本体")
    @GetMapping(value = "/findAllNoumenon")
    @ResponseBody
    public ListResult<List<KnwNoumenonVo>> findAll(@RequestParam String search) {
        return knwReportService.findAll(search);
    }

    /**
     * 2.分页查询本体
     */
    @ApiOperation(value = "分页查询本体", notes = "分页查询本体")
    @PostMapping(value = "/findPage",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult<PageResultVo<KnwNoumenonVo>> findPage(@RequestBody KnwNoumenonPageVo vo) {
        return knwReportService.findPage(vo);
    }

    /**
     * 3.根据本体soid查询所有本体Slot
     */
    @ApiOperation(value = "查询所有本体Slot", notes = "查询所有本体Slot")
    @GetMapping(value = "/findAllSlot")
    @ResponseBody
    public ListResult<List<KnwSlotVo>> findAllSoltBynoumenonSoid(@RequestParam Long noumenonSoid) {
        return knwReportService.findAllSoltBynoumenonSoid(noumenonSoid);
    }

    /**
     * 4.根据本体soid分页查询slot
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @PostMapping(value = "/selectSlot",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult<PageResultVo<KnwSlotVo>> findPage(@RequestBody KnwSlotPageVo vo) {
        return knwReportService.findPageSlotBynoumenonSoid(vo);
    }

    /**
     * 5.根据本体soid获取本体
     * @param soid
     * @return
     */
    @ApiOperation(value = "根据本体soid获取本体", notes = "根据本体soid获取本体")
    @ApiImplicitParam(name = "soid", value = "本体soid", required = false)
    @GetMapping(value = "/getKnwNoumenon")
    @ResponseBody
    public ListResult<KnwNoumenonVo> get(@RequestParam Long soid) {
        return knwReportService.get(soid);
    }

    /**
     * 6.根据slotSoid查询slot
     * @param soid
     * @return
     */
    @ApiOperation(value = "根据slotSoid查询slot",notes = "根据slotSoid查询slot")
    @ApiImplicitParam(name = "soid", value = "slotSoid", required = true)
    @GetMapping(value = "/getSlotBySlotSoid")
    @ResponseBody
    public ListResult<KnwSlotVo> findSlotBySlotSoid(@RequestParam Long soid){
        return knwReportService.findSlotBySlotSoid(soid);
    }

    /**
     * 查询标准、精准片段
     */
    @ApiOperation(value = "查询标准、精准片段", notes = "查询标准、精准片段")
    @PostMapping(value = "/getKnwNoumenonVoList",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult<List<KnwNoumenonVo>> getKnwNoumenonVoList(@RequestBody KnwNoumenonPageVo vo) {
         //UserVo loginUser = loginUserService.getLoginUser(request);
        // vo.setDoctorSoid(loginUser.getEmployeeSoid());
        return knwReportService.getKnwNoumenonVoList(vo);
    }


    /**
     * 人体树根节点获取
     */
    @PostMapping(value = "/getBodyRootNode",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult<List<BodyTreeVo>> getBodyRootNode(@RequestBody BodyTreeParameterVo vo) {
        return knwReportService.getBodyRootNode(vo);
    }

    /**
     * 人体树根节点获取
     */
    @PostMapping(value = "/getBodyNodes",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult<List<BodyTreeVo>> getBodyNodes(@RequestBody BodyTreeParameterVo vo) {
        return knwReportService.getBodyNodes(vo);
    }

    /**
     * getBodyMaps
     * @param vo
     * @return
     */
    @PostMapping(value = "/getBodyMaps",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult getBodyMaps(@RequestBody PatientInfoParameterVo vo) {
        return knwReportService.getBodyMaps(vo);
    }

//    /**
//     * 取得推荐诊断列表
//     * @param vo
//     * @return
//     */
//    @PostMapping(value = "/getRecommendDiagnosticList",produces = { "application/json;charset=UTF-8" })
//    @ResponseBody
//    public ListResult getRecommendDiagnosticList(@RequestBody PatientInfoParameterVo vo) {
//        return knwReportService.getRecommendDiagnosticList(vo);
//    }


    /**
     * 根据部位soid、检查类型soid查询相关领域本体的soid
     * @param vo
     * @return
     */
    @PostMapping(value = "/getNoumenonDomainSoids",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult getNoumenonDomainSoids(@RequestBody PatientInfoParameterVo vo) {
        return knwReportService.getNoumenonDomainSoids(vo);
    }

    /**
     *
     * @param conceptSoids
     * @return
     */
    @PostMapping(value = "/getKnwNoumenons",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult<List<KnwNoumenonVo>> getKnwNoumenons(@RequestBody List<Long> conceptSoids) {
        return knwReportService.getKnwNoumenons(conceptSoids);
    }

    /**
     *
     * @param listSoid
     * @return
     */
    @PostMapping(value = "/getBodyTree",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult<List<BodyTreeVo>> getBodyTree(@RequestBody List<Long> listSoid) {
        return knwReportService.getBodyTree(listSoid);
    }

    /**
     *
     * @param mapParm
     * @return
     */
        @PostMapping(value = "/getKnwNoumenonList",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult<List<KnwNoumenonVo>> getKnwNoumenonList(@RequestBody Map<String, Object> mapParm) {
        return knwReportService.getKnwNoumenonList(mapParm);
    }

    /**
     *
     * @param mapParm
     * @return
     */
    @PostMapping(value = "/getRecommendDiagnosticList",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult<List<KnwIndividualSoltVos>> getRecommendDiagnosticList(@RequestBody Map<String, Object> mapParm) {
        return knwReportService.getRecommendDiagnosticList(mapParm);
    }


    /**
     *
     * @param mapParm
     * @return
     */
    @PostMapping(value = "/getKnwNoumenonByConceptSoid",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    public ListResult<KnwNoumenonVo> getKnwNoumenonByConceptSoid(@RequestBody Long conceptSoid) {
        return knwReportService.getKnwNoumenonByConceptSoid(conceptSoid);
    }

    /**
     * 根据概念soid查询所有概念描述信息
     * @param conceptualSoid
     * @return
     */
    @ApiOperation(value = "根据概念soid查询所有概念描述信息", notes = "根据概念soid查询所有概念描述信息")
    @PostMapping(value = "/findAllByConceptSoid",produces = { "application/json;charset=UTF-8" })
    public ListResult<List<KnwConceptualDetail>> findAllByConceptSoid(@RequestBody Long conceptualSoid) {
        return knwReportService.findAllByConceptSoid(conceptualSoid);
    }

    /**
     * 根据概念描述soid查询概念描述信息
     * @param conceptualDetailSoid
     * @return
     */
    @ApiOperation(value = "根据概念描述soid查询概念描述信息",notes = "根据概念描述soid查询概念描述信息")
    @PostMapping(value = "/findByConceptualDetailSoid",produces = {"application/json;charset=UTF-8"})
    @ResponseBody
    public ListResult<KnwConceptualDetail> findByConceptualDetailSoid(@RequestBody Long conceptualDetailSoid){
        return knwReportService.findByConceptualDetailSoid(conceptualDetailSoid);
    }

}
